package src.Base;

import java.util.ArrayList;

public class Symbol {
    private  String token;//当前单词所对应的字符串
    private int type;//0 -> a, 1 -> a[], 2 -> a[][], -1 -> func
    private  int con;//1 -> const, 0 -> var
    boolean isFunc = false;
    class Func{
        int retype;// 0 -> int, 1->void
        int paramNum; //参数数量
        ArrayList<Symbol> parameters;
    }
    Func func = new Func();
    public Symbol(String token, int type, int con){
        this.con = con;
        this.token = token;
        this.type = type;
    }
    public int getCon(){
        return con;
    }
    public Symbol(String token, int type, int con, int retype, int paramNum, ArrayList<Symbol> parameters){
        this.type = type;
        this.token = token;
        this.con = con;
        this.func.parameters = parameters;
        this.func.paramNum = paramNum;
        this.func.retype = retype;
    }

    public int getType() {
        return type;
    }
    public int getRetype(){
        return func.retype;
    }
    public ArrayList<Symbol> getParams(){
        return func.parameters;
    }
}
